Hi All, |
Re: Regexp phonematch 0 In my other post you could add ... print in_RawPhonematch 1 "\t" in_RawPhonematch 2 "\t" in_RawPhonematch 3 "\n" to see how the paranthesis in the expression correspond to the matching ordinals; noticing that my first set of parens corresponds to match 1 etc. You have to play with it for a while to get used to it.
|
Re: Regexp llandale - Fri Aug 05 13:15:38 EDT 2011
Regular expression comparisons (and the "matches" command) only return booleans. But if succesful you can build the part of the string using the [match x] substring command. Since your Regexp has the end-of-string indicator '$' at the end, it won't ignore trailing white space and will fail. If you remove the '$' then anything after the other part of the regexp will be ignored, and it WILL match. You can then get the part that matches using: phone[match 0] In my other post you could add ... print in_RawPhone[match 1] "\t" in_RawPhone[match 2] "\t" in_RawPhone[match 3] "\n" to see how the paranthesis in the expression correspond to the matching ordinals; noticing that my first set of parens corresponds to match 1 etc. You have to play with it for a while to get used to it. |
Re: Regexp llandale - Fri Aug 05 13:18:01 EDT 2011 That is what I thought. I was hoping otherwise, but oh well. The match part I have not mastered yet. I tried using what you gave me and all I got abck was TRUE or FALSE. I am not sure waht I was doing wrong, but I was able to do it another way. Thanks for the reply though! Jerry |
Re: Regexp SystemAdmin - Fri Aug 05 15:07:29 EDT 2011
These two are basically the same:
Regexp re = regexp2("(e1)o1(e2)o2(e3(e4))")
if (re Target)
then Target[match 1] == e1
Target[match 2] == e2
Target[match 3] == e3
Target[match 4] == e4
|